﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace AjaxSnippets
{
    public class CallbackTriggerCollection : IList, ICollection, IEnumerable
    {
        private ArrayList _InnerList = new ArrayList(4);

        public CallbackTrigger this[int index]
        {
            get
            {
                return (CallbackTrigger)_InnerList[index];
            }
        }
        public int Add(CallbackTrigger item)
        {
            return this._InnerList.Add(item);
        }

        public void AddRange(CallbackTrigger[] items)
        {
            if (items == null)
            {
                throw new ArgumentNullException("items");
            }
            foreach (CallbackTrigger item in items)
            {
                this.Add(item);
            }
        }

        public void Clear()
        {
            this._InnerList.Clear();
        }

        public void Insert(int index, CallbackTrigger item)
        {
            _InnerList.Insert(index, item);
        }
        public bool Contains(CallbackTrigger item)
        {
            return _InnerList.Contains(item);
        }

        #region IList Members

        int IList.Add(object value)
        {
            return _InnerList.Add(value);
        }

        void IList.Clear()
        {
            _InnerList.Clear();
        }

        bool IList.Contains(object value)
        {
            return _InnerList.Contains(value);
        }

        int IList.IndexOf(object value)
        {
            return _InnerList.IndexOf(value);
        }

        void IList.Insert(int index, object value)
        {
            _InnerList.Insert(index, value);
        }

        bool IList.IsFixedSize
        {
            get { return false; }
        }

        bool IList.IsReadOnly
        {
            get { return false; }
        }

        void IList.Remove(object value)
        {
            _InnerList.Remove(value);
        }

        void IList.RemoveAt(int index)
        {
            _InnerList.RemoveAt(index);
        }

        object IList.this[int index]
        {
            get
            {
                return _InnerList[index];
            }
            set
            {
                _InnerList[index] = value;
            }
        }

        #endregion

        #region ICollection Members

        public void CopyTo(Array array, int index)
        {
            _InnerList.CopyTo(array, index);
        }

        public int Count
        {
            get { return _InnerList.Count; }
        }

        public bool IsSynchronized
        {
            get { return _InnerList.IsSynchronized; }
        }

        public object SyncRoot
        {
            get { return _InnerList.SyncRoot; }
        }

        #endregion

        #region IEnumerable Members

        public IEnumerator GetEnumerator()
        {
            return _InnerList.GetEnumerator();
        }

        #endregion
    }

}
